package com.cjkj.applet.controller;

import com.cjkj.applet.domain.dto.EcgAnalysisParam;
import com.cjkj.applet.service.TJ03ReportService;
import com.cjkj.common.core.web.domain.AjaxResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;

/**
 * 多参数监测仪小程序健康报告
 */
@RestController
@RequestMapping("/tj03/report")
@Validated
public class HealthReportTJ03Controller {

    @Resource
    private TJ03ReportService tj03ReportService;

    /**
     * 心率
     * @param visitNo 患者就诊号
     */
    @GetMapping("/heart")
    public AjaxResult getHeartReport(@NotNull(message = "患者就诊号不能为空！") Long visitNo) {
        return tj03ReportService.getTj03HeartReport(visitNo);
    }

    /**
     * 血压报告
     * @param visitNo 患者就诊号
     */
    @GetMapping("/bp")
    public AjaxResult getBpReport(@NotNull(message = "患者就诊号不能为空！") Long visitNo) {
        return tj03ReportService.getTj03BPReport(visitNo);
    }

    /**
     * 心电报告
     * @param visitNo 患者就诊号
     */
    @GetMapping("/ecg")
    public AjaxResult getEcgReport(@NotNull(message = "患者就诊号不能为空！") Long visitNo) {
        return tj03ReportService.getTj03EcgReport(visitNo);
    }

    /**
     * 心电报告分析
     * @param param 心电数据
     */
    @PostMapping("/ecg/analysis")
    public AjaxResult getEcgAnalysisData (@RequestBody @Valid EcgAnalysisParam param) {
        return AjaxResult.success(tj03ReportService.getEcgAnalysisData(param));
    }

}
